<?php
//核心文件 不需要单独修改
//页面编码
header("Content-type:text/html;charset=utf-8");
//定义系统路径
define("ROOT_PATH", str_replace("\\","/",dirname(__FILE__)));
define("SERVICEDIR", 'http://'.$_SERVER['SERVER_NAME']."/");

//设置时 init.php的session失效 使用qqConnectAPI的session配置 用于确保存放路径正确
if(!isset($new_session_set)){
	//sission设置
	//设置一个存放目录
	$savePath=ROOT_PATH."/../session_save/";
	//保存12小时
	$lifeTime = 43200;//保存12小时 (12*3600)
	//保存路径
	session_save_path($savePath);
	//生命周期
	session_set_cookie_params($lifeTime);
	session_start();
}

//防止超时
set_time_limit(0);
//亚洲/上海时间
date_default_timezone_set ('Asia/Shanghai');

//踢出非法访问
if(!defined('IN_templates')){
	echo "<script  type='text/javascript' language='javascript'>window.location.href='../index.php';</script>";
	exit();
}

//调用配置文件
include(ROOT_PATH."/config.db.php");
//调用Mysql数据库类
include(ROOT_PATH."/db.php");
//调用Functions方法类
include(ROOT_PATH."/functions.php");
//包含smarty类文件
include_once(ROOT_PATH."/class.smarty/Smarty.class.php");

//选择对应的模版文件夹
switch (IN_templates){
	case "admin":
		$cfg['defaultpl']="admin";
		break;
	case "maps":
		$cfg['defaultpl']="maps";
		break;
	default:
		$cfg['defaultpl']="default";
		break;
}

//获取系统时间
$m_now_time     = time();
$m_now_date_time= date('YmdHis',$m_now_time);
$m_now_date     = date('Y-m-d H:i:s',$m_now_time);
$m_now_counter  = date('Y-m-d',$m_now_time);
$m_now_month    = date('Y-m',$m_now_time);
$m_now_year     = date('Y',$m_now_time);


// Smarty模版配置 包含smarty类文件
//目录变量
$smarty_config_dir		= ROOT_PATH."/class.smarty/SmartyBC.class.php";
//是否使用缓存，项目在调试期间，不建议启用缓存
$smarty_caching			= false;
//设置模板目录
$smarty_template_dir	= ROOT_PATH."/../templates/".$cfg['defaultpl']."/";
//设置编译目录
$smarty_compile_dir		= ROOT_PATH."/../compile/".$cfg['defaultpl']."/";
//缓存文件夹
$smarty_cache_dir		= ROOT_PATH."/../cache/".$cfg['defaultpl']."/";
//缓存时间
$smarty_cache_lifetime 	= 0;
//smarty标识
$smarty_delimiter		= explode("|","<{|}>");

$smarty = new Smarty();							  					//建立smarty实例对象$smarty
$smarty->config_dir		 = $smarty_config_dir;	  					//目录变量
$smarty->caching		 = $smarty_caching;		  					//是否使用缓存，项目在调试期间，不建议启用缓存
$smarty->template_dir	 = $smarty_template_dir;  					//设置模板目录
$smarty->compile_dir	 = $smarty_compile_dir;   					//设置编译目录
$smarty->cache_dir		 = $smarty_cache_dir;	  					//缓存文件夹
$smarty->left_delimiter	 = $smarty_delimiter[0];  					//模版左边标识
$smarty->right_delimiter = $smarty_delimiter[1];  					//模版右边标识

//三网合并参数赋值页面
$smarty->assign("WEBDIR",WEBDIR);
$smarty->assign("DISCUZ_DOMAIN",DISCUZ_DOMAIN);
$smarty->assign("SHOPNC_DOMAIN",SHOPNC_DOMAIN);
?>